package it.uniroma2.structure.tree;

import java.util.Vector;

import it.uniroma2.gestoreontologie.Gestore;
import it.uniroma2.model.wizard.Parametri;
import it.uniroma2.structure.Service;

public class TreeTest {

	public static void main(String[] args) {
		
		Vector<Service> vec = new Vector();
		Vector<Service> vecIn = new Vector();
		Vector<String> istanze = new Vector();
		Gestore gestore = new Gestore(Parametri.NS, "file:G://ProgettiJava//OpinionMiningFramework//provaserviziclass.owl");
		istanze = gestore.cercaIndividual("Service");
		for (int i = 0; i < istanze.size(); i++) {
			if (istanze.elementAt(i) != null) {
				String nomeIns = istanze.elementAt(i).split("#")[1];
				vec.addElement(new Service(nomeIns));
			}
		}
		Service s1 = new Service("SVM_multi");
		s1.setRank(1);
		Service s2 = new Service("SVM_binary");
		s1.setRank(1);
		s2.setRank(2);
		vecIn.add(s1);
		//vecIn.add(s2);
		
		for(int i = 0; i < vec.size(); i++){
			System.out.println(vec.elementAt(i).getNome());
		}
		
		
		WorkflowTree wft = new WorkflowTree(vecIn, vec);
		//wft.shutService("TreeTagger_POS_tagger");
		for(int i = 0; i < wft.getTree().size(); i++){
			System.out.println("Servizi: " + wft.getTree().elementAt(i).getService().getNome() + " id: " + wft.getTree().elementAt(i).getId());
			for(int j = 0; j < wft.getTree().elementAt(i).getFatherVect().size(); j++){
				System.out.println("E' padre di: " + wft.getTree().elementAt(i).getFatherVect().elementAt(j));
			}
			
			
		}
		
		for(int i = 0; i < wft.listWorkflow.size(); i++){
			System.out.println("New Flusso");
			for(int k = 0; k < wft.listWorkflow.elementAt(i).size(); k++){
				System.out.println("Flusso: " + wft.listWorkflow.elementAt(i).elementAt(k));
			}
		}
		
//		Vector<WorkflowTreeNode> wtn = wft.generateSingleWorkflow(wft.listWorkflow.elementAt(1));
//		for(int i = 0; i < wtn.size(); i++){
//			System.out.println(wtn.elementAt(i).getService().getNome());
//		}
		
		wft.createProcess(wft.listWorkflow.elementAt(4));
		
		
		
		
		
	}
	
	
}
